

fil_source = '/media/lhpc04/da8a185a-95f0-4cbd-ba0a-5fe144872bd7/worksapce/code/test/python/remote_cmd/src/ipmsg_2.py'

fil_save = '/media/lhpc04/da8a185a-95f0-4cbd-ba0a-5fe144872bd7/worksapce/code/test/python/remote_cmd/src/ipmsg.py'

fw = open(fil_save, 'w') #as fw

with open(fil_source) as fr:
    for l in fr.readlines():
        dl = len(l)-len(l.lstrip())
        fw.write(dl*'    '+l.lstrip())

fw.close()